package com.ghbank.rdws.batchservice.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.Table;

import com.ghbank.rdws.common.entity.BaseEntity;

import lombok.Data;

/**
 * 批处理日志
 * @author xudong.liu
 * @date 2019年4月8日
 */
@Data
@Entity
@Table(name = "batch_log")
public class BatchLog extends BaseEntity {
    /**
     * 批次号
     */
    @Column(name = "batch_num")
    private String batchNum;
    /**
     * 回调地址
     */
    @Column(name = "callback_url")
    private String callbackUrl;
    /**
     * 请求IP
     */
    @Column(name = "ip_addr")
    private String ipAddr;
    /**
     * 请求TOKEN
     */
    @Column(name = "token")
    private String token;
    @Column(name = "result")
    /**
     * 批处理结果
     */
    private String result;
    
    @PrePersist
    protected void prePersist() {
      if (this.gmtCreate == null) gmtCreate = new Date();
      if (this.gmtModified == null) gmtModified = new Date();
    }
    
    @PreUpdate
    protected void preUpdate() {
      this.gmtModified = new Date();
    }
}
